"""
前置和后置操作
"""
import pytest
import requests
from api.api_login import login


@pytest.fixture(scope='session')
def first_login(environment):
    s = requests.Session()
    r = login(s, environment.BASE_URL, username='admin', password='admin123')
    token = r.json()['token']
    print(token)
    s.headers.update({
        "Authorization": f"Bearer {token}"
                      })
    print(r.text)

    yield s
    print("-------------后置操作---------------")
    s.close()

